package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.ClassRoom;
import cn.wolfcode.crm.mapper.ClassRoomMapper;
import cn.wolfcode.crm.query.QueryObject;
import cn.wolfcode.crm.service.IClassRoomService;
import cn.wolfcode.crm.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class ClassRoomServiceImpl implements IClassRoomService {
    @Autowired
    private ClassRoomMapper classRoomMapper;

    public void changState(Long id) {
        classRoomMapper.changState(id);
    }

    public PageResult query(QueryObject qo) {
        int total = classRoomMapper.query4Count(qo);
        if(total > 0){
            return new PageResult(total,classRoomMapper.query4List(qo));
        }
        return new PageResult(total, Collections.EMPTY_LIST);
    }

    public int deleteByPrimaryKey(Long id)
    {
        return classRoomMapper.deleteByPrimaryKey(id);
    }

    public int insert(ClassRoom record) {

        return classRoomMapper.insert(record);
    }

    public ClassRoom selectByPrimaryKey(Long id) {

        return classRoomMapper.selectByPrimaryKey(id);
    }

    public List<ClassRoom> selectAll() {

        return classRoomMapper.selectAll();
    }

    public int updateByPrimaryKey(ClassRoom record)
    {
        return classRoomMapper.updateByPrimaryKey(record);
    }
}
